package com.coda.context;

/**
 * 当前线程
 */
public class BaseContext {

    public static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    /**
     * 设置当前用户id
     */
    public static void setCurrentId(Integer id) {
        threadLocal.set(id);
    }

    /**
     * 获取当前用户的id
     */
    public static Integer getCurrentId() {
        return threadLocal.get();
    }

    /**
     * 删除当前id
     */
    public static void removeId() {
        threadLocal.remove();
    }
}
